package com.network.util;

import java.io.IOException;
import org.springframework.beans.BeansException;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public final class SpringUtil
{
	private static FileSystemXmlApplicationContext fsxac = null;

	public static void init(String xmlFile) throws BeansException, IOException
	{
//		fsxac = new FileSystemXmlApplicationContext(FilePathUtil.getAbsolutePath(xmlFile));
		fsxac = new FileSystemXmlApplicationContext(xmlFile);
	}

	public static Object getObject(String beanId) throws BeansException
	{
		Object obj = null;
		obj = fsxac.getBean(beanId);
		return obj;
	}

	public static Object getObject(String beanId, Class<?> className) throws BeansException
	{
		Object obj = null;
		obj = fsxac.getBean(beanId, className);
		return obj;
	}
}
